home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15651 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: kirki.cts.com!kirki
  2. From: kirki@cts.com (kirk i.)
  3. Newsgroups: comp.lang.c++
  4. Subject: Visual C++ Help Needed - Serialize/ar problem
  5. Date: Sun, 7 Apr 1996 13:27:33 LOCAL
  6. Organization: SEIDCON
  7. Message-ID: <kirki.2.057EA280@cts.com>
  8. NNTP-Posting-Host: kirki.cts.com
  9. Summary: getting a compiler error -- ambiguous operator
  10. Keywords: Serialize, Visual C++
  11.  
  12. Hi...newbe to OOD and Visual C++ here.  I created an object that initiates 3 
  13. edit boxes with the following intigers:
  14.  
  15.         int    m_seed = 0;
  16.         int    m_popsize = 0;
  17.         int    m_seed10 = m_seed +10;
  18.  
  19. all ...generally works well, in that the program window intiiates with the 
  20. values 0, 0, and 10...so, the next step was to use the Serialize 
  21. object/function to try to store and recall the three integer values after i 
  22. change them.  so, i applied the following code:
  23.  
  24. // CGene2Doc serialization
  25.  
  26. void CGene2Doc::Serialize(CArchive& ar)
  27. {
  28.     if (ar.IsStoring())
  29.     {
  30.         //itoa(m_seed, sSeed, 10); 
  31.         //itoa(m_popsize, sPopsize, 10); 
  32.         //itoa(m_seed, sSeed10, 10); 
  33.         
  34.         ar << m_seed;
  35.         ar << m_popsize;
  36.         ar << m_seed10;
  37.     }
  38.     else
  39.     {
  40.         //ar >> sSeed;
  41.         //ar >> sPopsize;
  42.         //ar >> sSeed10;
  43.         //m_seed = atoi(const char *sSeed);
  44.         //m_popsize = atoi(sPopsize);
  45.         //m_seed10 = atoi(sSeed10);
  46.     }
  47. }
  48.  
  49. when i compile, i get:
  50.  
  51. D:\Work\gene2\gene2doc.cpp
  52. D:\Work\gene2\gene2doc.cpp(61) : error C2593: 'operator <<' is ambiguous
  53. D:\Work\gene2\gene2doc.cpp(62) : error C2593: 'operator <<' is ambiguous
  54. D:\Work\gene2\gene2doc.cpp(63) : error C2593: 'operator <<' is ambiguous
  55.  
  56.  
  57. ...what did i do wrong here?
  58.  
  59. thanks in advance,
  60. kirk
  61.  
  62.